/*
 * @Description: 服务异常过滤器
 * @Author: Haor
 * @Date: 2022-05-09 10:00:21
 * @LastEditTime: 2022-05-09 11:24:38
 * @LastEditors: Haor
 */
import { ArgumentsHost, Catch } from '@nestjs/common'
import { ServerException } from "@exceptions";
import { BaseExceptionFilter } from './base-exception.filter'

@Catch(ServerException)
export class ServerExceptionFilter extends BaseExceptionFilter {
	constructor() {
		super()
		console.log('服务异常构造函数初始化' + new Date().toISOString())
	}

	catch(exception: ServerException, host: ArgumentsHost) {
		console.log('服务异常执行' + new Date().toISOString())
		this.writeToClient(host, exception)
	}
}
